package org.jeecg.enums.charge;

/**
 * 计算方式 （0：按月收费 ， 1：单价乘以面积）区分收费标准的价格
 */
public enum ChargeComputingTypeEnum {
    CHARGE_COMPUTING_TYPE_MONTH(0, "按月收费"),
    CHARGE_COMPUTING_TYPE_PRICE(1, "单价乘以面积");

    private Integer code;
    private String desc;

    ChargeComputingTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        ChargeComputingTypeEnum[] enums = values();
        for (ChargeComputingTypeEnum typeEnum : enums) {
            if (value.intValue() == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        ChargeComputingTypeEnum[] enums = values();
        for (ChargeComputingTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
